package com.qh.resourcehub.program.wifi.controller;

import com.qh.resourcehub.program.dto.VirtualDto;
import com.qh.resourcehub.program.dto.WifiDto;
import com.qh.resourcehub.program.virtual.service.VirtualExamineService;
import com.qh.resourcehub.program.vo.VirtualVo;
import com.qh.resourcehub.program.vo.WifiVo;
import com.qh.resourcehub.program.wifi.service.WifiExamineService;
import com.qh.resourcehub.utils.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//虚拟资源资料
@RestController
@RequestMapping("/wifiExamine")
public class WifiExamineController {
    @Autowired
    private WifiExamineService wifiExamineService;
    /*
     * @Description:
     * @param 查询 IP\wifi审核信息
     * @return
     * @Author: Y6
     * @Date: 2025/4/18 14:19
     */
    @PostMapping("/queryWifiExamineData")
    public ApiResponse queryWifiExamineData(@RequestBody WifiDto wifiDto ) {
        try {
            List<WifiVo> data = wifiExamineService.queryWifiExamineData(wifiDto);
            if (data.size()>0){
                return ApiResponse.succeed(data);
            }else {
                return ApiResponse.succeedNoData();
            }
        }catch (Exception e){
            return ApiResponse.succeedRequestNo();
        }
    }
    /**examine
     * IP\wifi资源通过
     * @param
     * @return
     */
    @PostMapping("/ApplicationPass")
    public ApiResponse ApplicationPass(@RequestBody WifiDto wifiDto) {
        try {
            int i = wifiExamineService.ApplicationPass(wifiDto);
            if (i>0){
                return ApiResponse.succeedRequest();
            }else {
                return ApiResponse.succeedRequestNo();
            }
        }catch (Exception e){
            return ApiResponse.succeedRequestNo();
        }
    }
    /**examine
     *  IP\wifi资源驳回
     * @param
     * @return
     */
    @PostMapping("/ApplicationReject")
    public ApiResponse ApplicationReject(@RequestBody WifiDto wifiDto) {
        try {
            int i = wifiExamineService.ApplicationReject(wifiDto);
            if (i>0){
                return ApiResponse.succeedRequest();
            }else {
                return ApiResponse.succeedRequestNo();
            }
        }catch (Exception e){
            return ApiResponse.succeedRequestNo();
        }
    }

}
